﻿///***************************************************************
/// 시  스  템 : SMFramework (based on Microsoft.Framework)
/// 단위시스템 : Configuration
/// 계      층 : Framework Configuration
/// 프로그램명 : WebConfig
/// 파  일  명 : WebConfig.cs
/// 설      명 : web.config에서 읽어들일 NameValueCollection값을 정의한다
///***************************************************************
/// 수정ID 일자       이름     내용
///---------------------------------------------------------------
/// CH001  2008-07-02 송시명   최초 작성
///***************************************************************
///
using System;
using System.Configuration;
using System.Collections.Specialized;

namespace SMFramework.Configuration
{
	/// <summary>
	///  Web.config NameValueCollection
	/// </summary>
	public class WebConfig
	{
		/// <summary>
		/// NameValueCollection내 key값의 value리턴
		/// </summary>
		/// <param name="nvc"></param>
		/// <param name="key"></param>
		/// <returns></returns>
		public static object GetValue(NameValueCollection nvc, string key)
		{
			try
			{
				return nvc[key].ToString();
			}
			catch (Exception)
			{
				throw new Exception("Web.config내에 " + key + "라는 key가 존재하지 않습니다");
			}
		}
		
		/// <summary>
		/// Web.config중 SMFramework관련 NameValueCollection
		/// </summary>
		public static NameValueCollection SMFramework
		{
			get
			{
				return (NameValueCollection)ConfigurationManager.GetSection("SMFramework.Config");
			}
		}
		
		/// <summary>
		///  Web.config중 UPDMS관련 NameValueCollection
		/// </summary>
		public static NameValueCollection Updms
		{
			get
			{
				return (NameValueCollection)ConfigurationManager.GetSection("Updms.Config");
			}
		}

		/// <summary>
		/// 메시지 한글
		/// </summary>
		public static NameValueCollection MsgKor
		{
			get
			{
				return (NameValueCollection)ConfigurationManager.GetSection("Updms.Message.Kor");
			}
		}

		/// <summary>
		/// 메시지 영문
		/// </summary>
		public static NameValueCollection MsgEng
		{
			get
			{
				return (NameValueCollection)ConfigurationManager.GetSection("Updms.Message.Eng");
			}
		}

		/// <summary>
		/// 메시지 출력형태
		/// </summary>
		public static NameValueCollection MsgOutput
		{
			get
			{
				return (NameValueCollection)ConfigurationManager.GetSection("Updms.Message.Output");
			}
		}
	}
}
